<template>
    <div>
        
    </div>
</template>


<script>
export default {
    created(){
        
        let that = this
        let obj = {}
        if(window.qc.Login.check()){
            window.qc.Login.getMe(function(openId, accessToken){
                obj.openid = openId
                that.$axios({
                    url:'user/qqinfo',
                    method:'get',
                    params:{
                        access_token:accessToken,
                        openid:openId,
                        oauth_consumer_key:101850878
                    }
                }).then(res=>{
                    // axios.post('user/qqlogin',`username=${res.data.data.nickname}&openid=${obj.openid}`)
                    that.$axios({
                        url:'user/qqlogin',
                        method:'post',
                        headers:{'content-type':'application/x-www-form-urlencoded'},                       
                        data:`username=${res.data.data.nickname}&openid=${obj.openid}`
                    })
                    .then(res=>{
                        if(res.data.status == -1){
                    alert(res.data.msg)
                }else{
                    that.$store.commit('setToken',res.data.data.token)
                    that.$router.push('/mime')
                }
                    })
                })
        })
        }
        
    }
}
</script>